import { IToolTip } from "../../../../../com/mui/manager/IToolTip";
import { ObjCreate } from "../ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { Language } from "../../../../../extend/language/Language";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { ScrollPolicy } from "../../../../../fl/controls/ScrollPolicy";
import { PageItemRenderer } from "../renderers/PageItemRenderer";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { KingCopyToolTipData } from "../../copy/kingCopy/info/KingCopyToolTipData";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { GTileList } from "../../../../../com/mui/controls/GTileList";
//class KingCopyToolTip
    
    export  class KingCopyToolTip /* flash.display.Sprite */ implements IToolTip
    {
        constructor()
        {
            
            this.createChildren();
            return;
        }

        /* internal  */createChildren(): void
        {
            ObjCreate.createBg(0, 0, 355, 200, this, ImagesConst.ToolTipBg);
            ObjCreate.createBg(20, 84, 315, 1, this, ImagesConst.SplitLine);
            var loc1=ObjCreate.createGTextField("", 0, 8, 355, 20, this);
            var loc2=loc1.defaultTextFormat;
            loc2.size = 16;
            loc2.align = flash.text.TextFormatAlign.CENTER;
            loc2.bold = true;
            loc1.defaultTextFormat = loc2;
            loc1.htmlText = Language.getString(80131);
            this._copyNameText = ObjCreate.createGTextField("", 18, 55, 250, 20, this, new GTextFormat(FontUtil.songtiName, 16, 16742658, true));
            var loc3=ObjCreate.createGTextField(Language.getString(27903), 18, 90, 355, 20, this, new GTextFormat(FontUtil.songtiName, 12, 16742658));
            this._rewards = ObjCreate.createTileList(30, 130, 230, 120, this);
            this._rewards.scrollPolicy = ScrollPolicy.OFF;
            this._rewards.columnWidth = 41;
            this._rewards.rowHeight = 41;
            this._rewards.setStyle("cellRenderer", PageItemRenderer);
            return;
        }

        /* internal  */initView(): void
        {
            var loc3=0;
            this._copyNameText.htmlText = HTMLUtil.addColor(this._tipData.copyName, "#FF7902") + " " + HTMLUtil.addColor(this._tipData.directionName, "#60e71e");
            var loc1=this._tipData.rewards.split(",");
            var loc2=new DataProvider([]);
            var loc4=0;
            var loc5=loc1;
            for(loc3 of loc5) 
            {
                loc2.addItem(loc3);
            }
            this._rewards.dataProvider = loc2;
            this._rewards.drawNow();
            return;
        }

        public set data(arg1)
        {
            this._tipData = arg1 as KingCopyToolTipData;
            this.initView();
            return;
        }

        /* internal */ /* var */_tipData: KingCopyToolTipData;

        /* internal */ /* var */_copyNameText: GTextFiled;

        /* internal */ /* var */_rewards: GTileList;
    }
